﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Roles.aspx.cs" Inherits="entgp.Usuarios.Roles" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Register Src="wucRoles.ascx" TagName="wucRoles" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ScriptManager ID="ScriptManager1" runat="server" AjaxMethodNamespace="RolAjax" Theme="Slate">
    </ext:ScriptManager>
    <script type="text/javascript" language="javascript">
        var EliminarRegistro = function () {
            Ext.MessageBox.show({
                title: "Eliminar Documento",
                msg: "Esta seguro de eliminar el item seleccionado?",
                buttons: Ext.MessageBox.OKCANCEL,
                fn: ConfirmDelDoc,
                icon: Ext.MessageBox.WARNING
            });
        }

        function ConfirmDelDoc(btn)
        {
            if(btn=='ok')
            {
                <%= GridPanelRoles.ClientID %>.deleteSelected();
             }
        };


    </script>
    <ext:Hidden ID="hidIdRol" runat="server">
    </ext:Hidden>
    <ext:Store runat="server" ID="StoreRol">
        <Reader>
            <ext:JsonReader ReaderID="Id">
                <Fields>
                    <ext:RecordField Name="Id" />
                    <ext:RecordField Name="Nombre" />
                    <ext:RecordField Name="Descripcion" />
                    <ext:RecordField Name="Codigo" />
                   
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    
    <ext:Panel ID="Panel1" BodyStyle="padding:15px;background-color:#E7E4DD;" runat="server"
        AutoHeight="true">
        <Body>
            <ext:Panel ID="Panel2" runat="server" BodyStyle="background-color:Transparent;" ButtonAlign="Center">
                <Body>
                    <ext:ColumnLayout ID="ColumnLayout1" runat="server">
                        <ext:LayoutColumn ColumnWidth=".5">
                            <ext:Panel ID="Panel3" runat="server" Border="false" Header="false" BodyStyle="padding:10px;background-color:Transparent;">
                                <Body>
                                    <ext:FormLayout ID="FormLayout1" runat="server" LabelAlign="Left" LabelWidth="70">
                                        <ext:Anchor Horizontal="95%">
                                           <ext:TextField FieldLabel="Nombre" ID="txtDescripcion" runat="server" />  
                                        </ext:Anchor>
                                    </ext:FormLayout>
                                </Body>
                            </ext:Panel>
                        </ext:LayoutColumn>
                        <ext:LayoutColumn ColumnWidth=".5">
                            <ext:Panel ID="Panel4" runat="server" Border="false" BodyStyle="padding:10px;background-color:Transparent;">
                                <Body>
                                    <ext:FormLayout ID="FormLayout2" LabelSeparator=":" runat="server" LabelAlign="Left"
                                        LabelWidth="65">
                                        <ext:Anchor Horizontal="95%">
                                            <ext:TextField FieldLabel="Descripción" ID="txtNombreRol" runat="server" />
                                        </ext:Anchor>
                                    </ext:FormLayout>
                                </Body>
                            </ext:Panel>
                        </ext:LayoutColumn>
                    </ext:ColumnLayout>
                </Body>
                <Buttons>
                    <ext:Button runat="server" ID="btnBuscar" Text="Buscar" Icon="Find">
                        <AjaxEvents>
                            <Click OnEvent="btnBuscar_Click">
                                <EventMask ShowMask="true" />
                            </Click>
                        </AjaxEvents>
                    </ext:Button>
                </Buttons>
            </ext:Panel>
        </Body>
    </ext:Panel>
    <ext:GridPanel ID="GridPanelRoles" runat="server" StoreID="StoreRol" StripeRows="true"
        AutoWidth="true" AutoHeight="true" Title="Listado de Roles">
        <TopBar>
            <ext:Toolbar runat="server">
                <Items>
                    <ext:Button runat="server" ID="btnNuevo" Text="Nuevo">
                        <AjaxEvents>
                            <Click OnEvent="btnNuevo_Click">
                            <ExtraParams>
                            <ext:Parameter Name="Operacion" Value="Nuevo" Mode="Value"></ext:Parameter>
                            </ExtraParams>
                            </Click>
                        </AjaxEvents>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:Column ColumnID="Nombre" Header="Nombre" Width="180" Sortable="true"
                    DataIndex="Nombre" />
                <ext:Column Header="Descrición" Sortable="true" DataIndex="Descripcion" />
                <ext:CommandColumn  Width="150">
                    <Commands>
                        <ext:GridCommand CommandName="Editar" Text="Editar" Icon="ApplicationEdit" ToolTip-Text="Editar datos del rol">
                        </ext:GridCommand>
                        <ext:GridCommand CommandName="Eliminar" Text="Eliminar" Icon="PageDelete" ToolTip-Text="Eliminar item">
                        </ext:GridCommand>
                    </Commands>
                </ext:CommandColumn>
            </Columns>
        </ColumnModel>
        <AjaxEvents>
            <Command OnEvent="command_Click">
                <ExtraParams>
                    <ext:Parameter Name="Operacion" Value="command" Mode="Raw" Encode="False" />
                    <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw" />
                 </ExtraParams>
            </Command>
        </AjaxEvents>
        <SelectionModel>
            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
            </ext:RowSelectionModel>
        </SelectionModel>
    </ext:GridPanel>
    <uc1:wucRoles runat="server" ID="wucRoles1" />
    </form>
</body>
</html>
